package com.yosaa.back.enums;

public enum MaleJumpScore {
    EXCELLENT_100(100, 273, 275),
    EXCELLENT_95(95, 268, 270),
    EXCELLENT_90(90, 263, 265),
    GOOD_85(85, 256, 258),
    GOOD_80(80, 248, 250),
    PASS_78(78, 244, 246),
    PASS_76(76, 240, 242),
    PASS_74(74, 236, 238),
    PASS_72(72, 232, 234),
    PASS_70(70, 228, 230),
    PASS_68(68, 224, 226),
    PASS_66(66, 220, 222),
    PASS_64(64, 216, 218),
    PASS_62(62, 212, 214),
    PASS_60(60, 208, 210),
    FAIL_50(50, 203, 205),
    FAIL_40(40, 198, 200),
    FAIL_30(30, 193, 195),
    FAIL_20(20, 188, 190),
    FAIL_10(10, 183, 185);

    private final float score;
    private final float freshmanSophomore; // 大一大二标准
    private final float juniorSenior; // 大三大四标准

    MaleJumpScore(float score, float freshmanSophomore, float juniorSenior) {
        this.score = score;
        this.freshmanSophomore = freshmanSophomore;
        this.juniorSenior = juniorSenior;
    }

    public float getScore() {
        return score;
    }

    public float getFreshmanSophomore() {
        return freshmanSophomore;
    }

    public float getJuniorSenior() {
        return juniorSenior;
    }

    // 根据成绩和年级计算分数
    public static float calculateScore(float distance, String grade) {
        for (MaleJumpScore standard : MaleJumpScore.values()) {
            float threshold = grade.equals("大一") || grade.equals("大二")
                    ? standard.getFreshmanSophomore()
                    : standard.getJuniorSenior();
            if (distance >= threshold) {
                return standard.getScore();
            }
        }
        return 0; // 默认分数
    }
}